//
//  ForumsChooseTypeController.swift
//  maopu
//
//  Created by 黄海波 on 2017/4/25.
//  Copyright © 2017年 maopu. All rights reserved.
//  选择发送帖子类型页面

import UIKit

class ForumsChooseTypeController: BaseViewController {
    fileprivate var closeBtn:UIButton!
    fileprivate var graphicPostsBtn:UIButton!
    fileprivate var videoPostsBtn:UIButton!

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.view.backgroundColor = UIColor.white
        
        self.closeBtn = UIButton.init(type: .custom)
        self.closeBtn.frame = CGRect.init(x: (AppWidth - 50)/2 , y: AppHeight - 100, width: 50, height: 50)
        self.closeBtn.setImage(UIImage.init(named: "reportBtn_icon"), for: UIControlState())
        self.closeBtn.imageView?.contentMode = .scaleToFill
        self.closeBtn.addTarget(self, action: #selector(self.btnClick(sender:)), for: .touchUpInside)
        self.closeBtn.tag = 0
        self.view.addSubview(self.closeBtn)
        
        self.graphicPostsBtn = UIButton.init(type: .custom)
        self.graphicPostsBtn.frame = CGRect.init(x: 50 , y: (AppHeight - 180)/2, width: 80, height: 100)
        self.graphicPostsBtn.set(image: UIImage.init(named: "graphicPosts_ico"), title: "图文贴", titlePosition: .bottom, additionalSpacing: 5, state: UIControlState.normal)
        self.graphicPostsBtn.setTitleColor(UIColor.m_textDeepColor(), for: UIControlState.normal)
        self.graphicPostsBtn.titleLabel?.font = UIFont.RegularDefaultFont(14)
        self.graphicPostsBtn.imageView?.contentMode = .scaleToFill
        self.graphicPostsBtn.addTarget(self, action: #selector(self.btnClick(sender:)), for: .touchUpInside)
        self.graphicPostsBtn.tag = 1
        self.view.addSubview(self.graphicPostsBtn)
        
        self.videoPostsBtn = UIButton.init(type: .custom)
        self.videoPostsBtn.frame = CGRect.init(x: AppWidth - 50 - 80 , y: (AppHeight - 180)/2, width: 80, height: 100)
        self.videoPostsBtn.set(image: UIImage.init(named: "videoPosts_ico"), title: "视频贴", titlePosition: .bottom, additionalSpacing: 5, state: UIControlState.normal)
        self.videoPostsBtn.setTitleColor(UIColor.m_textDeepColor(), for: UIControlState.normal)
        self.videoPostsBtn.titleLabel?.font = UIFont.RegularDefaultFont(14)
        self.videoPostsBtn.imageView?.contentMode = .scaleToFill
        self.videoPostsBtn.addTarget(self, action: #selector(self.btnClick(sender:)), for: .touchUpInside)
        self.videoPostsBtn.tag = 2
        self.view.addSubview(self.videoPostsBtn)
    
    }
    
    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        self.navigationController?.setNavigationBarHidden(true, animated: true)
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    @objc fileprivate func btnClick(sender:UIButton){
        if sender.tag == 0{
            self.dismiss(animated: true, completion: nil)
        }else if sender.tag == 1{
            let vc = SendPostsController()
            self.navigationController?.pushViewController(vc, animated: true)
        }else if sender.tag == 2{
            let vc = SendVideoPostsController()
            self.navigationController?.pushViewController(vc, animated: true)
        }
    }
}
